//处方综合点评
import React from 'react';
import { Card, Row, Col, Form, DatePicker, Select, Button, Icon, Table, Checkbox , message, Input  } from 'antd';
import { $http } from 'containers/config/https';
import Moment from 'moment';
import store from 'store';
import './style/index.less';
import PublicModalTable from './../../common/PublicModalTable';
const { Option } = Select;
const FormItem = Form.Item;
const formItemLayout = {    // label 和input宽度
    labelCol: { span:7 },
    wrapperCol: { span: 17 },
};
const formItemCheckbox = {    // label 和input宽度
    labelCol: { span:7 },
    wrapperCol: { span: 2 },
};
const ComprehensiveReview = Form.create()(
    class extends React.Component {
        constructor() {
            super();
            this.state = {
                userInfo: JSON.parse(window.sessionStorage.userData),
                data: [],
                queryCondition: {},
                SelectData: {},
                inOpLocDr:'',
                vendor: '',
                WaListData: [], //库存单数据
                modalData: [],
                stockID: '',
                ModalRowData: {}, // 弹框双击选中行数据
                ChineseEnglishSize: [],
                total:'',//点评单内数据数量
                prescNo: '', // 点评单号
                baseDrugFlag: false, //基础药物标志
                selectCount:'',
                selectType:true,
                checkboxShowR: false, //随机数的状态
                checkboxShowP: false, //百分比的状态
                valueR: '',
                valueP: '',
                Pharmacist: {},
                pid: '', //现成数
            }
            this.modalColumns = [
                {
                    key: 1,
                    title: this.state.userInfo.language == 'EN' ? 'Inventory item code' : '药品代码',
                    dataIndex: 'stockCode',
                    align: "center",
                    width: '22%'
                },
                {
                    key: 2,
                    title: this.state.userInfo.language == 'EN' ? 'Inventory item description' : '药品描述',
                    dataIndex: 'stockDesc',
                    align: "center",
                    width: '24%',
                },
                {
                    key: 5,
                    title: this.state.userInfo.language == 'EN' ? 'Inventory classification' : '库存分类',
                    dataIndex: 'stkSubCatDesc',
                    align: "center",
                    width: '16%',
                },
                {
                    key: 3,
                    title: this.state.userInfo.language == 'EN' ? 'Packing specification' : '包装规格',
                    dataIndex: 'stockSpec',
                    align: "center",
                    width: '12%',
                },
                {
                    key: 6,
                    title: this.state.userInfo.language == 'EN' ? 'Basic unit' : '基本单位',
                    dataIndex: 'baseUnitDesc',
                    align: "center",
                    width: '12%',
                },
                {
                    key: 7,
                    title: this.state.userInfo.language == 'EN' ? 'Storage unit' : '入库单位',
                    dataIndex: 'purUnitDesc',
                    align: "center",
                }
            ]
        }

        componentDidMount() {
            // 初始化数据
            this.getTacitlyApproveData();
        }

        componentWillUnmount() {
            // 组件销毁前将静止让setState修改state的状态，防止内存泄漏
            this.setState = (state,callback)=>{ return; }
        }

        // 获取明系列表头数据
        getDetailTableColumns = () => {
            let {userInfo} = this.state;
            let data = {
                params: [{
                    reactCode: ['StorageDetailsQuery'],
                    compontName: 'StorageDetailsQuery',
                    type: 'C',
                }]
            }
            $http.post('urlS', this, {
                code: '01040073',
                data: data,
                success: function (res) {
                    if (+res.errorCode === 0) {
                        let arr = res.result.C&&res.result.C.length > 0 ? JSON.parse(JSON.stringify(res.result.C)).map((item, index) => {
                            return  {
                                ...item,
                                key: index + 1,
                                title: <div onDoubleClick={() => { this.columnRef.onOpenModel();}}>{userInfo.language== 'EN' ? item.enDescripts : item.title}</div>
                            }
                        }) : '';
                        let filterArr = arr.filter(function(item){ return item.display === 'Y'});
                        // this.setState({columns: filterArr, detailWidthTotal: res.totalWidth,ChineseEnglishSize:userInfo.language=='EN' ? res.result.language.EN : res.result.language.CN})
                    }
                }
            });
        };

        //清空表格内容
        handleReset = () => {
            this.setState({WaListData: [],total: '', auditDate: '', batchSP: '', valueP: '', valueR: ''});
            this.props.form.resetFields();
            this.props.form.setFieldsValue({percentage: false});
            this.props.form.setFieldsValue({random: false});
        };

        // 获取界面默认值
        getTacitlyApproveData() {
            let data = {
                params: []
            };
            let data2 = {
                params: [{
                    locID: ''
                }]
            };
            // 获取下拉数据
            $http.post('urlS', this, {
                code: "02020296",
                data: data,
                success: function (res) {
                    if (+res.errorCode === 0) {
                        this.setState({SelectData: res})
                    }
                }
            });
            $http.post('urlS', this, {
                code: "02020297",
                data: data2,
                success: function (res) {
                    if (+res.errorCode === 0) {
                        this.setState({Pharmacist: res})
                    }
                }
            })
        }
        // 抽取处方评论
        selectOrderPresc=()=>{
            let {ChineseEnglishSize} = this.state;
            let random = this.props.form.getFieldValue('random');
            let percentage = this.props.form.getFieldValue('percentage');
            let spotCheck = this.props.form.getFieldValue('spotCheck');
            let timeInterval = this.props.form.getFieldValue('TimeInterval');
            let totalRequired = this.props.form.getFieldValue('totalRequired');
            let Suggested = this.props.form.getFieldValue('Suggested');
            let total = this.props.form.getFieldValue('total');
            if(random || percentage){
                this.props.form.validateFields((error, value)=>{
                    let obj = JSON.parse(JSON.stringify(value));
                    if(error == null){
                        let data = {
                            params: [{
                                // selectType: this.state.selectType?this.state.selectType:"",
                                // selectCount: this.state.selectCount?this.state.selectCount:"",
                                // total: total ,
                                // pid: this.state.pid,
                                random:this.state.valueR ? this.state.valueR : '',
                                percentage: this.state.valueP ? this.state.valueP : '',
                                spotCheck: spotCheck ? spotCheck : '',
                                timeInterval: timeInterval ? timeInterval : '',
                                totalRequired: totalRequired ? totalRequired : '',
                                Suggested: Suggested ? Suggested : '',

                                startDate: obj.StartDate ? Moment(obj.StartDate).format( 'YYYY-MM-DD') : undefined,
                                endDate: obj.endDate ? Moment(obj.endDate).format('YYYY-MM-DD') : undefined,
                                phcatDr: obj.phcatDr ? obj.phcatDr : "",
                                admType: obj.admType ? obj.admType : "",
                                Outpatient: obj.Outpatient?obj.Outpatient:"",
                                stockID: this.state.stockID?this.state.stockID:"",
                                doctor: obj.doctor ? "" : '',
                                orderType: obj.orderType ? obj.orderType : '',
                                admReason: obj.admReason?obj.admReason:"",
                                pharmacy: obj.pharmacy?obj.pharmacy:"",
                                maxAmt: obj.maxAmt?obj.maxAmt:"",
                                form: obj.form?obj.form:"",
                                minAge: obj.minAge?obj.minAge:"",
                                maxAge: obj.maxAge?obj.maxAge:"",
                                poison: obj.poison?obj.poison:"",
                                baseDrugFlag: this.state.baseDrugFlag ? this.state.baseDrugFlag : ''
                            }]
                        };
                        $http.post('urlS', this, {
                            code: "02020299",
                            data: data,
                            success: function (res) {
                                if(res.errorCode== 0){
                                    this.handleReset();
                                    this.props.form.setFieldsValue({prescNo: res.prescNo});
                                    message.success(res.errorMessage)
                                    // this.setState({ prescNo: res.prescNo});

                                }
                            },
                            error: function (err) {
                                message.error(err.errorMessage)
                            }
                        });
                    }
                })
            }else {
                message.error('随机数和百分比必须输入其中一项')
            }
        };

        // 统计处方总数
        searchAllOrderData=()=>{
            let {ChineseEnglishSize} = this.state;
            this.props.form.validateFields((error, value)=>{
                let obj = JSON.parse(JSON.stringify(value));
                if(error == null){
                    let data = {
                        params: [{
                            startDate: obj.StartDate ? Moment(obj.StartDate).format( 'YYYY-MM-DD') : undefined,
                            endDate: obj.endDate ? Moment(obj.endDate).format('YYYY-MM-DD') : undefined,
                            phcatDr: obj.phcatDr ? obj.phcatDr : "",
                            admType: obj.admType ? obj.admType : "",
                            Outpatient: obj.Outpatient?obj.Outpatient:"",
                            stockID: this.state.stockID?this.state.stockID:"",
                            doctor: obj.doctor ? "" : '',
                            orderType: obj.orderType ? obj.orderType : '',
                            admReason: obj.admReason?obj.admReason:"",
                            pharmacy: obj.pharmacy?obj.pharmacy:"",
                            maxAmt: obj.maxAmt?obj.maxAmt:"",
                            form: obj.form?obj.form:"",
                            minAge: obj.minAge?obj.minAge:"",
                            maxAge: obj.maxAge?obj.maxAge:"",
                            poison: obj.poison?obj.poison:"",
                            baseDrugFlag: this.state.baseDrugFlag ? this.state.baseDrugFlag : ''
                        }]
                    };
                    $http.post('urlS', this, {
                        code: "02020298",
                        data: data,
                        success: function (res) {
                            if(res.errorCode== 0){
                                this.props.form.setFieldsValue({total: res.total});
                                this.setState({ total: res.total,pid: res.pid});
                                message.success(res.errorMessage)
                            }
                        }
                    });
                }
            })

        };

        // 获取描述列表数据
        getModalListData(alias) {
            let data = {
                params: [
                    {
                        stockAlias: alias, // 库存项描述别名
                        frLocID: this.state.frLocDr ? this.state.frLocDr : undefined
                    }
                ]
            };
            $http.post('urlS', this, {
                code: "02020042",
                data: data,
                success: function (res) {
                    if (+res.errorCode === 0) {
                        for (var i = 0; i < res.result.length; i++) {
                            res.result[i].key = i
                        }
                        this.setState({ modalData: res.result })
                    } else {
                        this.setState({ modalData: [] })
                    }
                }
            })
        }
        // 描述回车事件
        stockDescOnPressEnter = (e) => {
            let top = document.getElementById('stock-desc').getBoundingClientRect().top + 40 + 'px';
            let left = document.getElementById('stock-desc').getBoundingClientRect().left + 100 + 'px';
            this.setState({
                top: top,
                left: left
            });
            this.getModalListData(e.target.value);
            this.child.showModal();
        };

        // 当描述失去焦点的时候
        stastockDescOnBlure = (e) => {
            if (this.state.ModalRowData && (e.target.value !== this.state.ModalRowData.stockDesc)) {
                this.props.form.setFieldsValue({ stockDesc: undefined });
            }
        };

        // 操作弹框
        onClickRowPublic = (record) => {
            return {
                onDoubleClick: () => {
                    this.confirmSelection(record);
                }
            }
        };
        // 双击选中行数据的回调
        confirmSelection = (record) => {
            // this.resetFields();
            this.setState({ ModalRowData: record }, () => {
                this.setState({ stockID: record.stockID });
                this.props.form.setFieldsValue({ stockDesc: record.stockDesc });
                // 关闭弹窗
                this.child.handleCancel();
            })
        };

        onchangeStock = (val) => {
            if (!val.target.value) {
                this.setState({ stockID: '' });
            }
        };

        onRef = (ref) => {
            this.child = ref;
        };

        onChangeSP=(e)=>{
            this.setState({baseDrugFlag: e.target.checked})
        };

        percentageChange=(e) =>{
            this.props.form.setFieldsValue({random: false});
            this.setState({checkboxShowP:e.target.checked, checkboxShowR: false ,valueR: ''});
        };
        randomChange =(e)=>{
            this.props.form.setFieldsValue({percentage: false});
            this.setState({checkboxShowR:e.target.checked, checkboxShowP: false, valueP: ''})
        }
        percentageInput=(v)=>{
            this.setState({valueP: v.target.value})
        }
        randomInput=(v)=>{
            this.setState({valueR: v.target.value})
        }
        render() {
            const { getFieldDecorator } = this.props.form;
            let {ChineseEnglishSize,userInfo} = this.state;
            //就诊类型
            let admTypeSelect = [];
            this.state.SelectData.admType && this.state.SelectData.admType.map((item, i) => {
                admTypeSelect.push(<Option value={item.id} key={i}>{item.descripts}</Option>)
            });
            //医生科室
            let OutpatientSelect = [];
            this.state.SelectData.Outpatient && this.state.SelectData.Outpatient.map((item, i) => {
                OutpatientSelect.push(<Option value={item.id} key={i}>{item.descripts}</Option>)
            });
            //处方类型
            let orderTypeSelect = [];
            this.state.SelectData.orderType && this.state.SelectData.orderType.map((item, i) => {
                orderTypeSelect.push(<Option value={item.id} key={i}>{item.descripts}</Option>)
            });
            //医嘱费别
            let admReasonSelect = [];
            this.state.SelectData.admReason && this.state.SelectData.admReason.map((item, i) => {
                admReasonSelect.push(<Option value={item.id} key={i}>{item.descripts}</Option>)
            });
            //药房名称
            let pharmacySelect = [];
            this.state.SelectData.pharmacy && this.state.SelectData.pharmacy.map((item, i) => {
                pharmacySelect.push(<Option value={item.id} key={i}>{item.descripts}</Option>)
            });
            //剂型列表
            let formSelect = [];
            this.state.SelectData.form && this.state.SelectData.form.map((item, i) => {
                formSelect.push(<Option value={item.id} key={i}>{item.descripts}</Option>)
            });
            //管制分类列表
            let poisonSelect = [];
            this.state.SelectData.poison && this.state.SelectData.poison.map((item, i) => {
                poisonSelect.push(<Option value={item.id} key={i}>{item.descripts}</Option>)
            });
            //医生
            let PharmacistSelect = [];
            this.state.Pharmacist.doctor && this.state.Pharmacist.doctor.map((item, i) => {
                PharmacistSelect.push(<Option value={item.id} key={i} seatchprop={item.descripts + item.descriptsSPCode}>{item.descripts}</Option>)
            });
            let param = {
                width: '600px',
                top: this.state.top,
                left: this.state.left,
                columns: this.modalColumns,
                data: this.state.modalData,
                isOnRow: true,
                TableClassName: 'tab-placeholder',
            };
            return (
                <div className="ComprehensiveReview">
                    <Row>
                        <Card
                            size="small"
                            title={<div className="card-title-left-icon"><div></div>{ChineseEnglishSize.InventoryAlarmAccordingToConsuaccToConsumption ? ChineseEnglishSize.InventoryAlarmAccordingToConsuaccToConsumption.descripts:'处方综合点评'}</div>}
                        >
                            <Col span={20}>
                                <Form>
                                    <Row >
                                        <Col span={6}>
                                            <FormItem {...formItemLayout} label={ChineseEnglishSize.InventoryAlarmAccordingToConsuStartDate ? ChineseEnglishSize.InventoryAlarmAccordingToConsuStartDate.descripts:'起初日期'}>
                                                {getFieldDecorator('StartDate',{
                                                    initialValue: Moment(),
                                                    rules: [{required: true, message: '起初日期不能为空',}],
                                                })(
                                                    <DatePicker format="YYYY-MM-DD" style={{width:'100%'}}/>
                                                ) }
                                            </FormItem>
                                        </Col>
                                        <Col span={6}>
                                            <FormItem {...formItemLayout} label={ChineseEnglishSize.InventoryAlarmAccordingToConsudeadline ? ChineseEnglishSize.InventoryAlarmAccordingToConsudeadline.descripts:'截止日期'}>
                                                {getFieldDecorator('endDate',{
                                                    initialValue: Moment(),
                                                    rules: [{required: true, message: '截止日期不能为空',}],
                                                })(
                                                    <DatePicker  format="YYYY-MM-DD" style={{width:'100%'}}/>
                                                ) }
                                            </FormItem>
                                        </Col>
                                        <Col span={6}>
                                            <FormItem {...formItemLayout} label={ChineseEnglishSize.InventoryAlarmAccordingToConsuloc ? ChineseEnglishSize.InventoryAlarmAccordingToConsuloc.descripts:'就诊类型'}>
                                                {getFieldDecorator('admType',{
                                                    initialValue: "",
                                                    rules:[{ required : ChineseEnglishSize.InventoryAlarmAccordingToConsuloc ? ChineseEnglishSize.InventoryAlarmAccordingToConsuloc.required =='Y'? true:false: false, message: ChineseEnglishSize.InventoryAlarmAccordingToConsuloc ? ChineseEnglishSize.InventoryAlarmAccordingToConsuloc.message:'就诊类型不能为空'}]
                                                })(
                                                    <Select allowClear>
                                                        {admTypeSelect}
                                                    </Select>
                                                ) }
                                            </FormItem>
                                        </Col>
                                        <Col span={6}>
                                            <FormItem {...formItemLayout} label='处方总数'>
                                                {getFieldDecorator('total',{
                                                    initialValue: '',
                                                    rules:[{ required : false, message: '处方总数不能为空'}]
                                                })(
                                                 <Input disabled />
                                                ) }
                                            </FormItem>
                                        </Col>
                                    </Row>
                                    <Row >
                                        <Col span={6}>
                                            <FormItem {...formItemLayout} label={ChineseEnglishSize.InventoryAlarmAccordingToConsuloc ? ChineseEnglishSize.InventoryAlarmAccordingToConsuloc.descripts:'医生科室'}>
                                                {getFieldDecorator('Outpatient',{
                                                    initialValue: "",
                                                    rules:[{ required: false, message: ChineseEnglishSize.InventoryAlarmAccordingToConsuloc ? ChineseEnglishSize.InventoryAlarmAccordingToConsuloc.message:'医生科室不能为空'}]
                                                })(
                                                    <Select allowClear>
                                                        {OutpatientSelect}
                                                    </Select>
                                                ) }
                                            </FormItem>
                                        </Col>
                                        <Col span={6}>
                                            <FormItem {...formItemLayout} label={ChineseEnglishSize.InventoryAlarmAccordingToConsuloc ? ChineseEnglishSize.InventoryAlarmAccordingToConsuloc.descripts:'医生'}>
                                                {getFieldDecorator('doctor',{
                                                    initialValue: '',
                                                    rules:[{ required: false, message: ChineseEnglishSize.InventoryAlarmAccordingToConsuloc ? ChineseEnglishSize.InventoryAlarmAccordingToConsuloc.message:'医生不能为空'}]
                                                })(
                                                    <Select allowClear showSearch optionFilterProp="seatchprop" >
                                                        {this.state.Pharmacist.doctor && this.state.Pharmacist.doctor.map(item => {
                                                            return <Option key={item.id} value={item.id} title={item.descripts} seatchprop={item.descripts + item.descriptsSPCode}>{item.descripts}</Option>
                                                        })}
                                                    </Select>
                                                ) }
                                            </FormItem>
                                        </Col>

                                        <Col span={6}>
                                            <FormItem {...formItemLayout} label={ChineseEnglishSize.InventoryAlarmAccordingToConsuloc ? ChineseEnglishSize.InventoryAlarmAccordingToConsuloc.descripts:'处方类型'}>
                                                {getFieldDecorator('orderType',{
                                                    initialValue: "",
                                                    rules:[{ required : ChineseEnglishSize.InventoryAlarmAccordingToConsuloc ? ChineseEnglishSize.InventoryAlarmAccordingToConsuloc.required =='Y'? true:false: false, message: ChineseEnglishSize.InventoryAlarmAccordingToConsuloc ? ChineseEnglishSize.InventoryAlarmAccordingToConsuloc.message:'处方类型不能为空'}]
                                                })(
                                                    <Select allowClear>
                                                        {orderTypeSelect}
                                                    </Select>
                                                ) }
                                            </FormItem>
                                        </Col>
                                        <Col span={6}>
                                            <FormItem {...formItemLayout} label={ChineseEnglishSize.InventoryAlarmAccordingToConsuloc ? ChineseEnglishSize.InventoryAlarmAccordingToConsuloc.descripts:'抗菌药物级别'}>
                                                {getFieldDecorator('inOpType0',{
                                                    initialValue: "",
                                                    rules:[{ required : ChineseEnglishSize.InventoryAlarmAccordingToConsuloc ? ChineseEnglishSize.InventoryAlarmAccordingToConsuloc.required =='Y'? true:false: false, message: ChineseEnglishSize.InventoryAlarmAccordingToConsuloc ? ChineseEnglishSize.InventoryAlarmAccordingToConsuloc.message:'抗菌药物级别不能为空'}]
                                                })(
                                                    <Select allowClear>
                                                        {orderTypeSelect}
                                                    </Select>
                                                ) }
                                            </FormItem>
                                        </Col>
                                    </Row>
                                    <Row >
                                        <Col span={6} id='stock-desc'>
                                            <FormItem label="药品名称" {...formItemLayout}>
                                            {getFieldDecorator('stockDesc', {
                                            rules: [{required: false, message: 'Please input your groupClass',}],
                                            })(
                                             <Input placeholder='回车检索药品相关信息' allowClear onPressEnter={this.stockDescOnPressEnter} onBlur={this.stastockDescOnBlure} onChange={this.onchangeStock} />
                                            )}
                                            </FormItem>
                                        </Col>
                                    <Col span={6}>
                                            <FormItem {...formItemLayout} label={ChineseEnglishSize.InventoryAlarmAccordingToConsuloc ? ChineseEnglishSize.InventoryAlarmAccordingToConsuloc.descripts:'医嘱费别'}>
                                                {getFieldDecorator('admReason',{
                                                    initialValue: "",
                                                    rules:[{ required : ChineseEnglishSize.InventoryAlarmAccordingToConsuloc ? ChineseEnglishSize.InventoryAlarmAccordingToConsuloc.required =='Y'? true:false: false, message: ChineseEnglishSize.InventoryAlarmAccordingToConsuloc ? ChineseEnglishSize.InventoryAlarmAccordingToConsuloc.message:'医嘱费别不能为空'}]
                                                })(
                                                    <Select allowClear>
                                                        {admReasonSelect}
                                                    </Select>
                                                ) }
                                            </FormItem>
                                        </Col>
                                        <Col span={6}>
                                            <FormItem {...formItemLayout} label={ChineseEnglishSize.InventoryAlarmAccordingToConsuloc ? ChineseEnglishSize.InventoryAlarmAccordingToConsuloc.descripts:'药房名称'}>
                                                {getFieldDecorator('pharmacy',{
                                                    initialValue: "",
                                                    rules:[{ required : ChineseEnglishSize.InventoryAlarmAccordingToConsuloc ? ChineseEnglishSize.InventoryAlarmAccordingToConsuloc.required =='Y'? true:false: false, message: ChineseEnglishSize.InventoryAlarmAccordingToConsuloc ? ChineseEnglishSize.InventoryAlarmAccordingToConsuloc.message:'药房名称不能为空'}]
                                                })(
                                                    <Select allowClear>
                                                        {pharmacySelect}
                                                    </Select>
                                                ) }
                                            </FormItem>
                                        </Col>
                                        <Col span={6}>
                                            <FormItem {...formItemLayout} label={ChineseEnglishSize.InventoryAlarmAccordingToConsuloc ? ChineseEnglishSize.InventoryAlarmAccordingToConsuloc.descripts:'管制分类'}>
                                                {getFieldDecorator('poison',{
                                                    initialValue: "",
                                                    rules:[{ required : ChineseEnglishSize.InventoryAlarmAccordingToConsuloc ? ChineseEnglishSize.InventoryAlarmAccordingToConsuloc.required =='Y'? true:false: false, message: ChineseEnglishSize.InventoryAlarmAccordingToConsuloc ? ChineseEnglishSize.InventoryAlarmAccordingToConsuloc.message:'管制分类不能为空'}]
                                                })(
                                                    <Select allowClear>
                                                        {poisonSelect}
                                                    </Select>
                                                ) }
                                            </FormItem>
                                        </Col>
                                    </Row>
                                    <Row >
                                        <Col span={6}>
                                            <FormItem {...formItemLayout} label={ChineseEnglishSize.InventoryAlarmAccordingToConsuloc ? ChineseEnglishSize.InventoryAlarmAccordingToConsuloc.descripts:'药学分类'}>
                                                {getFieldDecorator('phcatDr',{
                                                    initialValue: "",
                                                    rules:[{ required : ChineseEnglishSize.InventoryAlarmAccordingToConsuloc ? ChineseEnglishSize.InventoryAlarmAccordingToConsuloc.required =='Y'? true:false: false, message: ChineseEnglishSize.InventoryAlarmAccordingToConsuloc ? ChineseEnglishSize.InventoryAlarmAccordingToConsuloc.message:'药学分类不能为空'}]
                                                })(
                                                    <Input style={{ width: '100%' }} />
                                                ) }
                                            </FormItem>
                                        </Col>
                                        <Col span={6}>
                                            <FormItem {...formItemLayout} label={ChineseEnglishSize.InventoryAlarmAccordingToConsuloc ? ChineseEnglishSize.InventoryAlarmAccordingToConsuloc.descripts:'处方金额大于'}>
                                                {getFieldDecorator('maxAmt',{
                                                    initialValue: "",
                                                    rules:[{ required : ChineseEnglishSize.InventoryAlarmAccordingToConsuloc ? ChineseEnglishSize.InventoryAlarmAccordingToConsuloc.required =='Y'? true:false: false, message: ChineseEnglishSize.InventoryAlarmAccordingToConsuloc ? ChineseEnglishSize.InventoryAlarmAccordingToConsuloc.message:'处方金额不能为空'}]
                                                })(
                                                    <Input style={{ width: '100%' }} />
                                                ) }
                                            </FormItem>
                                        </Col>
                                        <Col span={6}>
                                            <FormItem {...formItemLayout} label={ChineseEnglishSize.InventoryAlarmAccordingToConsuloc ? ChineseEnglishSize.InventoryAlarmAccordingToConsuloc.descripts:'剂型'}>
                                                {getFieldDecorator('form',{
                                                    initialValue: "",
                                                    rules:[{ required : ChineseEnglishSize.InventoryAlarmAccordingToConsuloc ? ChineseEnglishSize.InventoryAlarmAccordingToConsuloc.required =='Y'? true:false: false, message: ChineseEnglishSize.InventoryAlarmAccordingToConsuloc ? ChineseEnglishSize.InventoryAlarmAccordingToConsuloc.message:'剂型不能为空'}]
                                                })(
                                                    <Select allowClear>
                                                        {formSelect}
                                                    </Select>
                                                ) }
                                            </FormItem>
                                        </Col>
                                        <Col span={6}>
                                            <FormItem {...formItemLayout} label={ChineseEnglishSize.InventoryAlarmAccordingToConsuloc ? ChineseEnglishSize.InventoryAlarmAccordingToConsuloc.descripts:'疗程大于'}>
                                                {getFieldDecorator('manf',{
                                                    initialValue: "",
                                                    rules:[{ required : ChineseEnglishSize.InventoryAlarmAccordingToConsuloc ? ChineseEnglishSize.InventoryAlarmAccordingToConsuloc.required =='Y'? true:false: false, message: ChineseEnglishSize.InventoryAlarmAccordingToConsuloc ? ChineseEnglishSize.InventoryAlarmAccordingToConsuloc.message:'疗程不能为空'}]
                                                })(
                                                    <Select allowClear>
                                                        {formSelect}
                                                    </Select>
                                                ) }
                                            </FormItem>
                                        </Col>
                                    </Row>
                                    <Row>
                                        <Col span={6}>
                                            <FormItem {...formItemLayout} label={ChineseEnglishSize.InventoryAlarmAccordingToConsuloc ? ChineseEnglishSize.InventoryAlarmAccordingToConsuloc.descripts:'病人年龄下限'}>
                                                {getFieldDecorator('minAge',{
                                                    initialValue: "",
                                                    rules:[{ required : ChineseEnglishSize.InventoryAlarmAccordingToConsuloc ? ChineseEnglishSize.InventoryAlarmAccordingToConsuloc.required =='Y'? true:false: false, message: ChineseEnglishSize.InventoryAlarmAccordingToConsuloc ? ChineseEnglishSize.InventoryAlarmAccordingToConsuloc.message:'病人年龄下限不能为空'}]
                                                })(
                                                    <Input style={{ width: '100%' }} />
                                                ) }
                                            </FormItem>
                                        </Col>
                                        <Col span={6}>
                                            <FormItem {...formItemLayout} label={ChineseEnglishSize.InventoryAlarmAccordingToConsuloc ? ChineseEnglishSize.InventoryAlarmAccordingToConsuloc.descripts:'病人年龄上限'}>
                                                {getFieldDecorator('maxAge',{
                                                    initialValue: "",
                                                    rules:[{ required : ChineseEnglishSize.InventoryAlarmAccordingToConsuloc ? ChineseEnglishSize.InventoryAlarmAccordingToConsuloc.required =='Y'? true:false: false, message: ChineseEnglishSize.InventoryAlarmAccordingToConsuloc ? ChineseEnglishSize.InventoryAlarmAccordingToConsuloc.message:'病人年龄上限不能为空'}]
                                                })(
                                                    <Input style={{ width: '100%' }} />
                                                ) }
                                            </FormItem>
                                        </Col>
                                        <Col span={6}>
                                            <Col span={13} style={{paddingLeft: '45px',marginTop: '10px'}}>
                                                <Checkbox onChange={this.onChangeSP}>基本药物</Checkbox>
                                            </Col>
                                        </Col>
                                    </Row>
                                </Form>
                            </Col>
                            <Col span={4} style={{textAlign:'center'}}>
                                <Row style={{marginBottom: '18px'}} className="button">
                                    <Button  onClick={this.searchAllOrderData}>{ChineseEnglishSize.InventoryAlarmAccordingToConsusearch ? ChineseEnglishSize.InventoryAlarmAccordingToConsusearch.descripts:'查询'}</Button>
                                </Row>
                                {/*<Row style={{marginBottom: '18px'}} className="button">*/}
                                    {/*<Button type="primary" onClick={this.handleReset}>{ChineseEnglishSize.InventoryAlarmAccordingToConsuclean ? ChineseEnglishSize.InventoryAlarmAccordingToConsuclean.descripts:'清屏'}</Button>*/}
                                {/*</Row>*/}
                            </Col>
                        </Card>
                    </Row>
                    <Row>
                        <Card
                            size="small"
                            title={<div className="card-title-left-icon"><div></div>{ChineseEnglishSize.InventoryAlarmAccordingToConsuaccToConsumption ? ChineseEnglishSize.InventoryAlarmAccordingToConsuaccToConsumption.descripts:'生成点评单'}</div>}
                        >
                            <Col span={20}>
                                    <Row >
                                        <Col span={6}>
                                            <FormItem {...formItemLayout} label={ChineseEnglishSize.InventoryAlarmAccordingToConsuloc ? ChineseEnglishSize.InventoryAlarmAccordingToConsuloc.descripts:'点评单号'}>
                                                {getFieldDecorator('prescNo',{
                                                    initialValue: this.state.prescNo,
                                                    rules:[{ required : ChineseEnglishSize.InventoryAlarmAccordingToConsuloc ? ChineseEnglishSize.InventoryAlarmAccordingToConsuloc.required =='Y'? true:false: false, message: ChineseEnglishSize.InventoryAlarmAccordingToConsuloc ? ChineseEnglishSize.InventoryAlarmAccordingToConsuloc.message:'点评单号不能为空'}]
                                                })(
                                                    <Input style={{ width: '100%' }} disabled />
                                                ) }
                                            </FormItem>
                                        </Col>
                                        <Col span={6} className='random'>
                                            <FormItem {...formItemCheckbox} label={ChineseEnglishSize.InventoryAlarmAccordingToConsuloc ? ChineseEnglishSize.InventoryAlarmAccordingToConsuloc.descripts:'随机数'}>
                                                {getFieldDecorator('random',{
                                                    valuePropName: 'checked',
                                                    initialValue: '',
                                                })(
                                                    <Checkbox onChange={this.randomChange}></Checkbox>
                                                ) }
                                            </FormItem>
                                            <span className='ran'><Input style={{ width: '60%' }} disabled={!this.state.checkboxShowR} value={this.state.valueR}  onChange={this.randomInput}  /></span>
                                        </Col>
                                        <Col span={6} className='percentage'>
                                            <FormItem {...formItemCheckbox} label={ChineseEnglishSize.InventoryAlarmAccordingToConsuloc ? ChineseEnglishSize.InventoryAlarmAccordingToConsuloc.descripts:'百分比'}>
                                                {getFieldDecorator('percentage',{
                                                    valuePropName: 'checked',
                                                    initialValue: '',
                                                })(
                                                    <Checkbox onChange={this.percentageChange}></Checkbox>
                                                ) }
                                            </FormItem>
                                            <span className='per'><Input style={{ width: '60%' }} disabled={!this.state.checkboxShowP} value={this.state.valueP} onChange={this.percentageInput} /></span>
                                        </Col>
                                        <Col span={6}>
                                            <FormItem {...formItemLayout} label={ChineseEnglishSize.InventoryAlarmAccordingToConsuloc ? ChineseEnglishSize.InventoryAlarmAccordingToConsuloc.descripts:'抽查数'}>
                                                {getFieldDecorator('spotCheck',{
                                                    initialValue: "",
                                                })(
                                                    <Input style={{ width: '100%' }} />
                                                ) }
                                            </FormItem>
                                        </Col>
                                    </Row>
                                <Row >
                                    <Col span={6}>
                                        <FormItem {...formItemLayout} label={ChineseEnglishSize.InventoryAlarmAccordingToConsuloc ? ChineseEnglishSize.InventoryAlarmAccordingToConsuloc.descripts:'时隔数'}>
                                            {getFieldDecorator('TimeInterval',{
                                                initialValue: "",
                                            })(
                                                <Input style={{ width: '100%' }} />
                                            ) }
                                        </FormItem>
                                    </Col>
                                    <Col span={6}>
                                        <FormItem {...formItemLayout} label={ChineseEnglishSize.InventoryAlarmAccordingToConsuloc ? ChineseEnglishSize.InventoryAlarmAccordingToConsuloc.descripts:'理论所需总数'}>
                                            {getFieldDecorator('totalRequired',{
                                                initialValue: "",
                                            })(
                                                <Input style={{ width: '100%' }} />
                                            ) }
                                        </FormItem>
                                    </Col>
                                    <Col span={6}>
                                        <FormItem {...formItemLayout} label={ChineseEnglishSize.InventoryAlarmAccordingToConsuloc ? ChineseEnglishSize.InventoryAlarmAccordingToConsuloc.descripts:'建议时隔数'}>
                                            {getFieldDecorator('Suggested',{
                                                initialValue: "",
                                            })(
                                                <Input style={{ width: '100%' }} />
                                            ) }
                                        </FormItem>
                                    </Col>
                                </Row>
                                <Row style={{margin: '20px 0 0 112px'}} className="button">
                                    <Button disabled={this.state.total ==0 ? true : false}  onClick={this.selectOrderPresc}>{ChineseEnglishSize.InventoryAlarmAccordingToConsusearch ? ChineseEnglishSize.InventoryAlarmAccordingToConsusearch.descripts:'抽取处方样本'}</Button>
                                </Row>
                            </Col>
                        </Card>
                    </Row>
                    <PublicModalTable onClickRowPublic={this.onClickRowPublic}  param={param} onRef={this.onRef} />
                </div>
            )
        }
    }
);
export default ComprehensiveReview;